<?php

namespace App\Models\Cruise;

use App\Models\BaseModel;
use App\Models\Traits\KfUid;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasOne;

class CruiseCheckAgainstShopMappingModel extends BaseModel
{
    use KfUid;

    protected $table    = 'cruise_check_against_shop_mappings';
    protected $fillable = [
        'shopId',
        'version',
    ];

    /**
     * 新增门店违约函版本
     * @param array $data
     * @return Builder|Model
     */
    public static function addCheckAgainstShop(array $data)
    {
        return self::query()->create($data);
    }


    /**
     * 根据id查询违约函门店映射表
     * @param $shopId
     * @return Builder|Model|object|null
     */
    public static function getVersionByShopId($shopId)
    {
        return self::query()->where(['shopId' => $shopId])->value('version');
    }

}
